package com.buddies.lottery.ui.entry;

import com.buddies.lottery.base.BasePresenter;
import com.buddies.lottery.data.BaseObserver;
import com.buddies.lottery.data.DataManager;
import com.buddies.lottery.data.resp.LotteryConfigResponse;

public class EntryPresenter extends BasePresenter<EntryContract.View> implements EntryContract.Presenter {

    public EntryPresenter(EntryContract.View view) {
        super(view);
    }

    @Override
    public void loadLotteryConfig() {
        addSubscription(DataManager.getInstance().getLotteryRepo().getLotteryConfig(), new BaseObserver<LotteryConfigResponse>() {
            @Override
            public void onNext(LotteryConfigResponse response) {
                mView.onLotteryConfigLoaded(response);
            }

            @Override
            public void onError(Throwable e) {
                mView.onError(e);
            }
        });
    }

}
